--author:lee
--date:2021.06.25
local ngx        = ngx
local require    = require
local ns_env     = require("modules.env.env")
local ns_config  = require("modules.business_welfare.config.welfare_config" .. ns_env.debug) --0 1 2 10 12
local business_common    = require("modules.business_common.business_common")

ns_config.debug      = ns_env.debug
ns_config.auth_debug = ns_env.auth_debug
ngx.cache.debug_log  = ns_env.debug_log


--严禁在此修改,保持原样,新增key,移步到modules.business_common.business_ssdb.lua文件中 notify:jimmy lee 2021 12 17
ns_config.SSDB_KEYS = {
    --NONE = 0,

    -- 加数据key的时候， 要在INVALID 前加， 并修改 INVALID 值

    LUCKY_BLOCK = 1,        -- 幸运方块
    WELFARE_GIFT  = 2,      -- 抽奖礼包数据

    -- 这里不在允许加SSDB_KEY 请移步到business_common 里添加，这里会做映射，那边加好这边可直接访问
    --INVALID = 3,
}
--保持国内正式服使用的ssdb-key维持不变,其他环境一律走新逻辑 notify:jimmy lee 2021 12 17
if ns_config.debug ~= 0 then
    ns_config.SSDB_KEYS.LUCKY_BLOCK = business_common.business_ssdb.KEYS.LUCKY_BLOCK
    ns_config.SSDB_KEYS.WELFARE_GIFT = business_common.business_ssdb.KEYS.WELFARE_GIFT    
end

setmetatable(ns_config.SSDB_KEYS, {__index = business_common.business_ssdb.KEYS})



ns_config.check_one_req = {
    lucky_block_data = 1,
    lucky_block_enter = 1,
    lucky_block_start = 1,
    lucky_block_pick_rewards = 1,
    lucky_block_delete_monkey = 1,
    lucky_block_destory_reward = 1,
    lucky_block_flush_all = 1,
    lucky_block_add_energy = 1,

    welfare_gift_use_item = 1,
    welfare_gift_buy_gift = 1,
    
    get_accumulate_reward = 1,
}

--商业化福利服加密key
ns_config.business_welfare_key =
{
    ["act"] = "3dbc5f33add11d1af78ba2af365e0952",
    ["cmd"] = "ebd733cd91fcef8cf0d46efefa728348"
}

-- 选择db
ns_config.select_ssdb = function(uin_)
    if uin_ == 0 or uin_ == "" then
        return "comm"
    end
    return uin_ % 10
end

-- shared_dict 缓存库前缀， 一般后面加(uin%10)
ns_config.dict_name = {
    one_request = "welfare_one_request",    --存储每一次成功调用的
}


--不按照拆分oplog
ns_config.oplog_not_apart = {
    welfare_error_op = 1,
}

return ns_config
